Left Termination of the query pattern mergesort_in_2(g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof

Clauses:

mergesort([], []).
mergesort(.(X, []), .(X, [])).
mergesort(.(X, .(Y, L1)), L2) :- ','(split2(.(X, .(Y, L1)), L3, L4), ','(mergesort(L3, L5), ','(mergesort(L4, L6), merge(L5, L6, L2)))).
split(L1, L2, L3) :- split0(L1, L2, L3).
split(L1, L2, L3) :- split1(L1, L2, L3).
split(L1, L2, L3) :- split2(L1, L2, L3).
split0([], [], []).
split1(.(X, []), .(X, []), []).
split2(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) :- split(L1, L2, L3).
merge([], L1, L1).
merge(L1, [], L1).
merge(.(X, L1), .(Y, L2), .(X, L3)) :- ','(le(X, Y), merge(L1, .(Y, L2), L3)).
merge(.(X, L1), .(Y, L2), .(Y, L3)) :- ','(gt(X, Y), merge(.(X, L1), L2, L3)).
gt(s(X), s(Y)) :- gt(X, Y).
gt(s(X), 0).
le(s(X), s(Y)) :- le(X, Y).
le(0, s(Y)).
le(0, 0).

Queries:

mergesort(g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof
  ↳ PrologToPiTRSProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1)), L2) → U11(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
MERGESORT_IN(.(X, .(Y, L1)), L2) → SPLIT2_IN(.(X, .(Y, L1)), L3, L4)
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U81(X, Y, L1, L2, L3, split_in(L1, L2, L3))
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U71(L1, L2, L3, split2_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U61(L1, L2, L3, split1_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT1_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U51(L1, L2, L3, split0_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT0_IN(L1, L2, L3)
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U21(X, Y, L1, L2, L4, mergesort_in(L3, L5))
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → MERGESORT_IN(L3, L5)
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U31(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → MERGESORT_IN(L4, L6)
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U41(X, Y, L1, L2, merge_in(L5, L6, L2))
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → MERGE_IN(L5, L6, L2)
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U131(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → U121(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U141(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U91(X, L1, Y, L2, L3, le_out(X, Y)) → U101(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
U101(x1, x2, x3, x4, x5, x6)  =  U101(x1, x6)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
U121(x1, x2, x3, x4, x5, x6)  =  U121(x3, x6)
U131(x1, x2, x3)  =  U131(x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
SPLIT0_IN(x1, x2, x3)  =  SPLIT0_IN(x1)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x5)
U71(x1, x2, x3, x4)  =  U71(x4)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x5, x6)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)
U51(x1, x2, x3, x4)  =  U51(x4)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
SPLIT1_IN(x1, x2, x3)  =  SPLIT1_IN(x1)
U41(x1, x2, x3, x4, x5)  =  U41(x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)
U141(x1, x2, x3)  =  U141(x3)
U61(x1, x2, x3, x4)  =  U61(x4)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1)), L2) → U11(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
MERGESORT_IN(.(X, .(Y, L1)), L2) → SPLIT2_IN(.(X, .(Y, L1)), L3, L4)
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U81(X, Y, L1, L2, L3, split_in(L1, L2, L3))
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U71(L1, L2, L3, split2_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U61(L1, L2, L3, split1_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT1_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U51(L1, L2, L3, split0_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT0_IN(L1, L2, L3)
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U21(X, Y, L1, L2, L4, mergesort_in(L3, L5))
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → MERGESORT_IN(L3, L5)
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U31(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → MERGESORT_IN(L4, L6)
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U41(X, Y, L1, L2, merge_in(L5, L6, L2))
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → MERGE_IN(L5, L6, L2)
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U131(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → U121(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U141(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U91(X, L1, Y, L2, L3, le_out(X, Y)) → U101(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
U101(x1, x2, x3, x4, x5, x6)  =  U101(x1, x6)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
U121(x1, x2, x3, x4, x5, x6)  =  U121(x3, x6)
U131(x1, x2, x3)  =  U131(x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
SPLIT0_IN(x1, x2, x3)  =  SPLIT0_IN(x1)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x5)
U71(x1, x2, x3, x4)  =  U71(x4)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x5, x6)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)
U51(x1, x2, x3, x4)  =  U51(x4)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
SPLIT1_IN(x1, x2, x3)  =  SPLIT1_IN(x1)
U41(x1, x2, x3, x4, x5)  =  U41(x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)
U141(x1, x2, x3)  =  U141(x3)
U61(x1, x2, x3, x4)  =  U61(x4)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 5 SCCs with 16 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
LE_IN(x1, x2)  =  LE_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
GT_IN(x1, x2)  =  GT_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))

The TRS R consists of the following rules:

le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPOrderProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U111(X, L1, Y, L2, gt_out) → MERGE_IN(.(X, L1), L2)
U91(X, L1, Y, L2, le_out) → MERGE_IN(L1, .(Y, L2))
MERGE_IN(.(X, L1), .(Y, L2)) → U111(X, L1, Y, L2, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2)) → U91(X, L1, Y, L2, le_in(X, Y))

The TRS R consists of the following rules:

le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U14(le_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U13(gt_in(X, Y))
U14(le_out) → le_out
U13(gt_out) → gt_out

The set Q consists of the following terms:

le_in(x0, x1)
gt_in(x0, x1)
U14(x0)
U13(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


MERGE_IN(.(X, L1), .(Y, L2)) → U111(X, L1, Y, L2, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2)) → U91(X, L1, Y, L2, le_in(X, Y))
The remaining pairs can at least be oriented weakly.

U111(X, L1, Y, L2, gt_out) → MERGE_IN(.(X, L1), L2)
U91(X, L1, Y, L2, le_out) → MERGE_IN(L1, .(Y, L2))
Used ordering: Polynomial interpretation [25]:

POL(.(x1, x2)) = 1 + x2   
POL(0) = 0   
POL(MERGE_IN(x1, x2)) = x1 + x2   
POL(U111(x1, x2, x3, x4, x5)) = 1 + x2 + x4   
POL(U13(x1)) = 1   
POL(U14(x1)) = 0   
POL(U91(x1, x2, x3, x4, x5)) = 1 + x2 + x4   
POL(gt_in(x1, x2)) = x1   
POL(gt_out) = 1   
POL(le_in(x1, x2)) = 0   
POL(le_out) = 0   
POL(s(x1)) = 1   

The following usable rules [17] were oriented: none



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof
              ↳ PiDP
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, le_out) → MERGE_IN(L1, .(Y, L2))
U111(X, L1, Y, L2, gt_out) → MERGE_IN(.(X, L1), L2)

The TRS R consists of the following rules:

le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U14(le_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U13(gt_in(X, Y))
U14(le_out) → le_out
U13(gt_out) → gt_out

The set Q consists of the following terms:

le_in(x0, x1)
gt_in(x0, x1)
U14(x0)
U13(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 2 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

SPLIT_IN(L1) → SPLIT2_IN(L1)
SPLIT2_IN(.(X, .(Y, L1))) → SPLIT_IN(L1)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ PiDPToQDPProof
  ↳ PrologToPiTRSProof

Pi DP problem:
The TRS P consists of the following rules:

U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → MERGESORT_IN(L3, L5)
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → MERGESORT_IN(L4, L6)
MERGESORT_IN(.(X, .(Y, L1)), L2) → U11(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U21(X, Y, L1, L2, L4, mergesort_in(L3, L5))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x4)
split2_out(x1, x2, x3)  =  split2_out(x2, x3)
split_out(x1, x2, x3)  =  split_out(x2, x3)
U6(x1, x2, x3, x4)  =  U6(x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x2, x3)
U5(x1, x2, x3, x4)  =  U5(x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out
U13(x1, x2, x3)  =  U13(x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x3, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out
U14(x1, x2, x3)  =  U14(x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x6)
merge_out(x1, x2, x3)  =  merge_out(x3)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x5, x6)
U11(x1, x2, x3, x4, x5)  =  U11(x5)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
QDP
                    ↳ QDPOrderProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

U21(L4, mergesort_out(L5)) → MERGESORT_IN(L4)
MERGESORT_IN(.(X, .(Y, L1))) → U11(split2_in(.(X, .(Y, L1))))
U11(split2_out(L3, L4)) → MERGESORT_IN(L3)
U11(split2_out(L3, L4)) → U21(L4, mergesort_in(L3))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1))) → U1(split2_in(.(X, .(Y, L1))))
split2_in(.(X, .(Y, L1))) → U8(X, Y, split_in(L1))
split_in(L1) → U7(split2_in(L1))
U7(split2_out(L2, L3)) → split_out(L2, L3)
split_in(L1) → U6(split1_in(L1))
split1_in(.(X, [])) → split1_out(.(X, []), [])
U6(split1_out(L2, L3)) → split_out(L2, L3)
split_in(L1) → U5(split0_in(L1))
split0_in([]) → split0_out([], [])
U5(split0_out(L2, L3)) → split_out(L2, L3)
U8(X, Y, split_out(L2, L3)) → split2_out(.(X, L2), .(Y, L3))
U1(split2_out(L3, L4)) → U2(L4, mergesort_in(L3))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
U2(L4, mergesort_out(L5)) → U3(L5, mergesort_in(L4))
U3(L5, mergesort_out(L6)) → U4(merge_in(L5, L6))
merge_in(.(X, L1), .(Y, L2)) → U11(X, L1, Y, L2, gt_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U13(gt_in(X, Y))
U13(gt_out) → gt_out
U11(X, L1, Y, L2, gt_out) → U12(Y, merge_in(.(X, L1), L2))
merge_in(.(X, L1), .(Y, L2)) → U9(X, L1, Y, L2, le_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U14(le_in(X, Y))
U14(le_out) → le_out
U9(X, L1, Y, L2, le_out) → U10(X, merge_in(L1, .(Y, L2)))
merge_in(L1, []) → merge_out(L1)
merge_in([], L1) → merge_out(L1)
U10(X, merge_out(L3)) → merge_out(.(X, L3))
U12(Y, merge_out(L3)) → merge_out(.(Y, L3))
U4(merge_out(L2)) → mergesort_out(L2)

The set Q consists of the following terms:

mergesort_in(x0)
split2_in(x0)
split_in(x0)
U7(x0)
split1_in(x0)
U6(x0)
split0_in(x0)
U5(x0)
U8(x0, x1, x2)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U13(x0)
U11(x0, x1, x2, x3, x4)
le_in(x0, x1)
U14(x0)
U9(x0, x1, x2, x3, x4)
U10(x0, x1)
U12(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


U21(L4, mergesort_out(L5)) → MERGESORT_IN(L4)
The remaining pairs can at least be oriented weakly.

MERGESORT_IN(.(X, .(Y, L1))) → U11(split2_in(.(X, .(Y, L1))))
U11(split2_out(L3, L4)) → MERGESORT_IN(L3)
U11(split2_out(L3, L4)) → U21(L4, mergesort_in(L3))
Used ordering: Matrix interpretation [3]:
Non-tuple symbols:
M( U7(x1) ) =
/1\
\0/
+
/10\
\00/
·x1

M( U10(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( U13(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( [] ) =
/1\
\0/

M( split2_in(x1) ) =
/0\
\0/
+
/01\
\00/
·x1

M( U12(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( 0 ) =
/0\
\0/

M( U3(x1, x2) ) =
/1\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( le_in(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\01/
·x2

M( split2_out(x1, x2) ) =
/0\
\0/
+
/11\
\00/
·x1+
/01\
\00/
·x2

M( mergesort_in(x1) ) =
/0\
\0/
+
/11\
\00/
·x1

M( mergesort_out(x1) ) =
/1\
\0/
+
/00\
\00/
·x1

M( U14(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( s(x1) ) =
/0\
\0/
+
/00\
\01/
·x1

M( split1_out(x1, x2) ) =
/0\
\0/
+
/01\
\00/
·x1+
/01\
\01/
·x2

M( gt_in(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( split0_out(x1, x2) ) =
/0\
\0/
+
/00\
\01/
·x1+
/00\
\01/
·x2

M( U5(x1) ) =
/1\
\0/
+
/01\
\00/
·x1

M( le_out ) =
/0\
\0/

M( split_in(x1) ) =
/1\
\0/
+
/01\
\00/
·x1

M( split1_in(x1) ) =
/0\
\0/
+
/01\
\00/
·x1

M( U8(x1, ..., x3) ) =
/1\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2+
/10\
\00/
·x3

M( U1(x1) ) =
/1\
\0/
+
/00\
\00/
·x1

M( U9(x1, ..., x5) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2+
/00\
\00/
·x3+
/00\
\00/
·x4+
/00\
\00/
·x5

M( split0_in(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( split_out(x1, x2) ) =
/1\
\0/
+
/01\
\00/
·x1+
/01\
\00/
·x2

M( U2(x1, x2) ) =
/1\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( .(x1, x2) ) =
/0\
\1/
+
/00\
\00/
·x1+
/00\
\01/
·x2

M( gt_out ) =
/0\
\0/

M( U11(x1, ..., x5) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2+
/00\
\00/
·x3+
/00\
\00/
·x4+
/00\
\00/
·x5

M( merge_out(x1) ) =
/0\
\0/
+
/00\
\00/
·x1

M( U6(x1) ) =
/1\
\0/
+
/10\
\01/
·x1

M( U4(x1) ) =
/1\
\0/
+
/00\
\00/
·x1

M( merge_in(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

Tuple symbols:
M( U11(x1) ) = 0+
[1,0]
·x1

M( MERGESORT_IN(x1) ) = 0+
[0,1]
·x1

M( U21(x1, x2) ) = 0+
[0,1]
·x1+
[1,0]
·x2


Matrix type:
We used a basic matrix type which is not further parametrizeable.


As matrix orders are CE-compatible, we used usable rules w.r.t. argument filtering in the order.
The following usable rules [17] were oriented:

le_in(0, s(Y)) → le_out
U1(split2_out(L3, L4)) → U2(L4, mergesort_in(L3))
split2_in(.(X, .(Y, L1))) → U8(X, Y, split_in(L1))
U8(X, Y, split_out(L2, L3)) → split2_out(.(X, L2), .(Y, L3))
split_in(L1) → U7(split2_in(L1))
U3(L5, mergesort_out(L6)) → U4(merge_in(L5, L6))
U5(split0_out(L2, L3)) → split_out(L2, L3)
U4(merge_out(L2)) → mergesort_out(L2)
split_in(L1) → U5(split0_in(L1))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
split_in(L1) → U6(split1_in(L1))
U6(split1_out(L2, L3)) → split_out(L2, L3)
U2(L4, mergesort_out(L5)) → U3(L5, mergesort_in(L4))
split1_in(.(X, [])) → split1_out(.(X, []), [])
le_in(0, 0) → le_out
split0_in([]) → split0_out([], [])
U14(le_out) → le_out
U7(split2_out(L2, L3)) → split_out(L2, L3)
le_in(s(X), s(Y)) → U14(le_in(X, Y))
mergesort_in(.(X, .(Y, L1))) → U1(split2_in(.(X, .(Y, L1))))



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ QDPOrderProof
QDP
                        ↳ DependencyGraphProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1))) → U11(split2_in(.(X, .(Y, L1))))
U11(split2_out(L3, L4)) → MERGESORT_IN(L3)
U11(split2_out(L3, L4)) → U21(L4, mergesort_in(L3))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1))) → U1(split2_in(.(X, .(Y, L1))))
split2_in(.(X, .(Y, L1))) → U8(X, Y, split_in(L1))
split_in(L1) → U7(split2_in(L1))
U7(split2_out(L2, L3)) → split_out(L2, L3)
split_in(L1) → U6(split1_in(L1))
split1_in(.(X, [])) → split1_out(.(X, []), [])
U6(split1_out(L2, L3)) → split_out(L2, L3)
split_in(L1) → U5(split0_in(L1))
split0_in([]) → split0_out([], [])
U5(split0_out(L2, L3)) → split_out(L2, L3)
U8(X, Y, split_out(L2, L3)) → split2_out(.(X, L2), .(Y, L3))
U1(split2_out(L3, L4)) → U2(L4, mergesort_in(L3))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
U2(L4, mergesort_out(L5)) → U3(L5, mergesort_in(L4))
U3(L5, mergesort_out(L6)) → U4(merge_in(L5, L6))
merge_in(.(X, L1), .(Y, L2)) → U11(X, L1, Y, L2, gt_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U13(gt_in(X, Y))
U13(gt_out) → gt_out
U11(X, L1, Y, L2, gt_out) → U12(Y, merge_in(.(X, L1), L2))
merge_in(.(X, L1), .(Y, L2)) → U9(X, L1, Y, L2, le_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U14(le_in(X, Y))
U14(le_out) → le_out
U9(X, L1, Y, L2, le_out) → U10(X, merge_in(L1, .(Y, L2)))
merge_in(L1, []) → merge_out(L1)
merge_in([], L1) → merge_out(L1)
U10(X, merge_out(L3)) → merge_out(.(X, L3))
U12(Y, merge_out(L3)) → merge_out(.(Y, L3))
U4(merge_out(L2)) → mergesort_out(L2)

The set Q consists of the following terms:

mergesort_in(x0)
split2_in(x0)
split_in(x0)
U7(x0)
split1_in(x0)
U6(x0)
split0_in(x0)
U5(x0)
U8(x0, x1, x2)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U13(x0)
U11(x0, x1, x2, x3, x4)
le_in(x0, x1)
U14(x0)
U9(x0, x1, x2, x3, x4)
U10(x0, x1)
U12(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 1 SCC with 1 less node.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ QDPOrderProof
                      ↳ QDP
                        ↳ DependencyGraphProof
QDP
                            ↳ UsableRulesProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1))) → U11(split2_in(.(X, .(Y, L1))))
U11(split2_out(L3, L4)) → MERGESORT_IN(L3)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1))) → U1(split2_in(.(X, .(Y, L1))))
split2_in(.(X, .(Y, L1))) → U8(X, Y, split_in(L1))
split_in(L1) → U7(split2_in(L1))
U7(split2_out(L2, L3)) → split_out(L2, L3)
split_in(L1) → U6(split1_in(L1))
split1_in(.(X, [])) → split1_out(.(X, []), [])
U6(split1_out(L2, L3)) → split_out(L2, L3)
split_in(L1) → U5(split0_in(L1))
split0_in([]) → split0_out([], [])
U5(split0_out(L2, L3)) → split_out(L2, L3)
U8(X, Y, split_out(L2, L3)) → split2_out(.(X, L2), .(Y, L3))
U1(split2_out(L3, L4)) → U2(L4, mergesort_in(L3))
mergesort_in(.(X, [])) → mergesort_out(.(X, []))
mergesort_in([]) → mergesort_out([])
U2(L4, mergesort_out(L5)) → U3(L5, mergesort_in(L4))
U3(L5, mergesort_out(L6)) → U4(merge_in(L5, L6))
merge_in(.(X, L1), .(Y, L2)) → U11(X, L1, Y, L2, gt_in(X, Y))
gt_in(s(X), 0) → gt_out
gt_in(s(X), s(Y)) → U13(gt_in(X, Y))
U13(gt_out) → gt_out
U11(X, L1, Y, L2, gt_out) → U12(Y, merge_in(.(X, L1), L2))
merge_in(.(X, L1), .(Y, L2)) → U9(X, L1, Y, L2, le_in(X, Y))
le_in(0, 0) → le_out
le_in(0, s(Y)) → le_out
le_in(s(X), s(Y)) → U14(le_in(X, Y))
U14(le_out) → le_out
U9(X, L1, Y, L2, le_out) → U10(X, merge_in(L1, .(Y, L2)))
merge_in(L1, []) → merge_out(L1)
merge_in([], L1) → merge_out(L1)
U10(X, merge_out(L3)) → merge_out(.(X, L3))
U12(Y, merge_out(L3)) → merge_out(.(Y, L3))
U4(merge_out(L2)) → mergesort_out(L2)

The set Q consists of the following terms:

mergesort_in(x0)
split2_in(x0)
split_in(x0)
U7(x0)
split1_in(x0)
U6(x0)
split0_in(x0)
U5(x0)
U8(x0, x1, x2)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U13(x0)
U11(x0, x1, x2, x3, x4)
le_in(x0, x1)
U14(x0)
U9(x0, x1, x2, x3, x4)
U10(x0, x1)
U12(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ QDPOrderProof
                      ↳ QDP
                        ↳ DependencyGraphProof
                          ↳ QDP
                            ↳ UsableRulesProof
QDP
                                ↳ QReductionProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1))) → U11(split2_in(.(X, .(Y, L1))))
U11(split2_out(L3, L4)) → MERGESORT_IN(L3)

The TRS R consists of the following rules:

split2_in(.(X, .(Y, L1))) → U8(X, Y, split_in(L1))
split_in(L1) → U7(split2_in(L1))
split_in(L1) → U6(split1_in(L1))
split_in(L1) → U5(split0_in(L1))
U8(X, Y, split_out(L2, L3)) → split2_out(.(X, L2), .(Y, L3))
split0_in([]) → split0_out([], [])
U5(split0_out(L2, L3)) → split_out(L2, L3)
split1_in(.(X, [])) → split1_out(.(X, []), [])
U6(split1_out(L2, L3)) → split_out(L2, L3)
U7(split2_out(L2, L3)) → split_out(L2, L3)

The set Q consists of the following terms:

mergesort_in(x0)
split2_in(x0)
split_in(x0)
U7(x0)
split1_in(x0)
U6(x0)
split0_in(x0)
U5(x0)
U8(x0, x1, x2)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U13(x0)
U11(x0, x1, x2, x3, x4)
le_in(x0, x1)
U14(x0)
U9(x0, x1, x2, x3, x4)
U10(x0, x1)
U12(x0, x1)
U4(x0)

We have to consider all (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

mergesort_in(x0)
U1(x0)
U2(x0, x1)
U3(x0, x1)
merge_in(x0, x1)
gt_in(x0, x1)
U13(x0)
U11(x0, x1, x2, x3, x4)
le_in(x0, x1)
U14(x0)
U9(x0, x1, x2, x3, x4)
U10(x0, x1)
U12(x0, x1)
U4(x0)



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ QDPOrderProof
                      ↳ QDP
                        ↳ DependencyGraphProof
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
QDP
                                    ↳ RuleRemovalProof
  ↳ PrologToPiTRSProof

Q DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1))) → U11(split2_in(.(X, .(Y, L1))))
U11(split2_out(L3, L4)) → MERGESORT_IN(L3)

The TRS R consists of the following rules:

split2_in(.(X, .(Y, L1))) → U8(X, Y, split_in(L1))
split_in(L1) → U7(split2_in(L1))
split_in(L1) → U6(split1_in(L1))
split_in(L1) → U5(split0_in(L1))
U8(X, Y, split_out(L2, L3)) → split2_out(.(X, L2), .(Y, L3))
split0_in([]) → split0_out([], [])
U5(split0_out(L2, L3)) → split_out(L2, L3)
split1_in(.(X, [])) → split1_out(.(X, []), [])
U6(split1_out(L2, L3)) → split_out(L2, L3)
U7(split2_out(L2, L3)) → split_out(L2, L3)

The set Q consists of the following terms:

split2_in(x0)
split_in(x0)
U7(x0)
split1_in(x0)
U6(x0)
split0_in(x0)
U5(x0)
U8(x0, x1, x2)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

MERGESORT_IN(.(X, .(Y, L1))) → U11(split2_in(.(X, .(Y, L1))))
U11(split2_out(L3, L4)) → MERGESORT_IN(L3)

Strictly oriented rules of the TRS R:

split_in(L1) → U7(split2_in(L1))
U7(split2_out(L2, L3)) → split_out(L2, L3)

Used ordering: POLO with Polynomial interpretation [25]:

POL(.(x1, x2)) = 2 + x1 + 2·x2   
POL(MERGESORT_IN(x1)) = 2 + 2·x1   
POL(U11(x1)) = 1 + 2·x1   
POL(U5(x1)) = 2 + 2·x1   
POL(U6(x1)) = 2 + x1   
POL(U7(x1)) = 1 + x1   
POL(U8(x1, x2, x3)) = 2 + x1 + x2 + 2·x3   
POL([]) = 0   
POL(split0_in(x1)) = x1   
POL(split0_out(x1, x2)) = x1 + 2·x2   
POL(split1_in(x1)) = 2·x1   
POL(split1_out(x1, x2)) = 2·x1 + 2·x2   
POL(split2_in(x1)) = x1   
POL(split2_out(x1, x2)) = 2 + x1 + x2   
POL(split_in(x1)) = 2 + 2·x1   
POL(split_out(x1, x2)) = 2 + x1 + x2   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
                  ↳ QDP
                    ↳ QDPOrderProof
                      ↳ QDP
                        ↳ DependencyGraphProof
                          ↳ QDP
                            ↳ UsableRulesProof
                              ↳ QDP
                                ↳ QReductionProof
                                  ↳ QDP
                                    ↳ RuleRemovalProof
QDP
                                        ↳ PisEmptyProof
  ↳ PrologToPiTRSProof

Q DP problem:
P is empty.
The TRS R consists of the following rules:

split2_in(.(X, .(Y, L1))) → U8(X, Y, split_in(L1))
split_in(L1) → U6(split1_in(L1))
split_in(L1) → U5(split0_in(L1))
U8(X, Y, split_out(L2, L3)) → split2_out(.(X, L2), .(Y, L3))
split0_in([]) → split0_out([], [])
U5(split0_out(L2, L3)) → split_out(L2, L3)
split1_in(.(X, [])) → split1_out(.(X, []), [])
U6(split1_out(L2, L3)) → split_out(L2, L3)

The set Q consists of the following terms:

split2_in(x0)
split_in(x0)
U7(x0)
split1_in(x0)
U6(x0)
split0_in(x0)
U5(x0)
U8(x0, x1, x2)

We have to consider all (P,Q,R)-chains.
The TRS P is empty. Hence, there is no (P,Q,R) chain.
We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1)), L2) → U11(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
MERGESORT_IN(.(X, .(Y, L1)), L2) → SPLIT2_IN(.(X, .(Y, L1)), L3, L4)
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U81(X, Y, L1, L2, L3, split_in(L1, L2, L3))
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U71(L1, L2, L3, split2_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U61(L1, L2, L3, split1_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT1_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U51(L1, L2, L3, split0_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT0_IN(L1, L2, L3)
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U21(X, Y, L1, L2, L4, mergesort_in(L3, L5))
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → MERGESORT_IN(L3, L5)
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U31(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → MERGESORT_IN(L4, L6)
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U41(X, Y, L1, L2, merge_in(L5, L6, L2))
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → MERGE_IN(L5, L6, L2)
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U131(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → U121(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U141(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U91(X, L1, Y, L2, L3, le_out(X, Y)) → U101(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
U101(x1, x2, x3, x4, x5, x6)  =  U101(x1, x2, x3, x4, x6)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
U121(x1, x2, x3, x4, x5, x6)  =  U121(x1, x2, x3, x4, x6)
U131(x1, x2, x3)  =  U131(x1, x2, x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
SPLIT0_IN(x1, x2, x3)  =  SPLIT0_IN(x1)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x1, x2, x3, x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x1, x2, x3, x5)
U71(x1, x2, x3, x4)  =  U71(x1, x4)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x1, x2, x3, x5, x6)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)
U51(x1, x2, x3, x4)  =  U51(x1, x4)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
SPLIT1_IN(x1, x2, x3)  =  SPLIT1_IN(x1)
U41(x1, x2, x3, x4, x5)  =  U41(x1, x2, x3, x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)
U141(x1, x2, x3)  =  U141(x1, x2, x3)
U61(x1, x2, x3, x4)  =  U61(x1, x4)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

MERGESORT_IN(.(X, .(Y, L1)), L2) → U11(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
MERGESORT_IN(.(X, .(Y, L1)), L2) → SPLIT2_IN(.(X, .(Y, L1)), L3, L4)
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U81(X, Y, L1, L2, L3, split_in(L1, L2, L3))
SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U71(L1, L2, L3, split2_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U61(L1, L2, L3, split1_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT1_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → U51(L1, L2, L3, split0_in(L1, L2, L3))
SPLIT_IN(L1, L2, L3) → SPLIT0_IN(L1, L2, L3)
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U21(X, Y, L1, L2, L4, mergesort_in(L3, L5))
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → MERGESORT_IN(L3, L5)
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U31(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → MERGESORT_IN(L4, L6)
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U41(X, Y, L1, L2, merge_in(L5, L6, L2))
U31(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → MERGE_IN(L5, L6, L2)
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → GT_IN(X, Y)
GT_IN(s(X), s(Y)) → U131(X, Y, gt_in(X, Y))
GT_IN(s(X), s(Y)) → GT_IN(X, Y)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → U121(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → LE_IN(X, Y)
LE_IN(s(X), s(Y)) → U141(X, Y, le_in(X, Y))
LE_IN(s(X), s(Y)) → LE_IN(X, Y)
U91(X, L1, Y, L2, L3, le_out(X, Y)) → U101(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
U101(x1, x2, x3, x4, x5, x6)  =  U101(x1, x2, x3, x4, x6)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
U121(x1, x2, x3, x4, x5, x6)  =  U121(x1, x2, x3, x4, x6)
U131(x1, x2, x3)  =  U131(x1, x2, x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
SPLIT0_IN(x1, x2, x3)  =  SPLIT0_IN(x1)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x1, x2, x3, x5, x6)
U81(x1, x2, x3, x4, x5, x6)  =  U81(x1, x2, x3, x6)
LE_IN(x1, x2)  =  LE_IN(x1, x2)
U11(x1, x2, x3, x4, x5)  =  U11(x1, x2, x3, x5)
U71(x1, x2, x3, x4)  =  U71(x1, x4)
U31(x1, x2, x3, x4, x5, x6)  =  U31(x1, x2, x3, x5, x6)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)
U51(x1, x2, x3, x4)  =  U51(x1, x4)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
SPLIT1_IN(x1, x2, x3)  =  SPLIT1_IN(x1)
U41(x1, x2, x3, x4, x5)  =  U41(x1, x2, x3, x5)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)
U141(x1, x2, x3)  =  U141(x1, x2, x3)
U61(x1, x2, x3, x4)  =  U61(x1, x4)
GT_IN(x1, x2)  =  GT_IN(x1, x2)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 5 SCCs with 16 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
LE_IN(x1, x2)  =  LE_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

LE_IN(s(X), s(Y)) → LE_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
GT_IN(x1, x2)  =  GT_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

GT_IN(s(X), s(Y)) → GT_IN(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, L3, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2), L3)
U111(X, L1, Y, L2, L3, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2, L3)
MERGE_IN(.(X, L1), .(Y, L2), .(X, L3)) → U91(X, L1, Y, L2, L3, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2), .(Y, L3)) → U111(X, L1, Y, L2, L3, gt_in(X, Y))

The TRS R consists of the following rules:

le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
MERGE_IN(x1, x2, x3)  =  MERGE_IN(x1, x2)
U111(x1, x2, x3, x4, x5, x6)  =  U111(x1, x2, x3, x4, x6)
U91(x1, x2, x3, x4, x5, x6)  =  U91(x1, x2, x3, x4, x6)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ RuleRemovalProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2))
U111(X, L1, Y, L2, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2)
MERGE_IN(.(X, L1), .(Y, L2)) → U111(X, L1, Y, L2, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2)) → U91(X, L1, Y, L2, le_in(X, Y))

The TRS R consists of the following rules:

le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))

The set Q consists of the following terms:

le_in(x0, x1)
gt_in(x0, x1)
U14(x0, x1, x2)
U13(x0, x1, x2)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.

Strictly oriented rules of the TRS R:

gt_in(s(X), 0) → gt_out(s(X), 0)

Used ordering: POLO with Polynomial interpretation [25]:

POL(.(x1, x2)) = 2·x1 + x2   
POL(0) = 1   
POL(MERGE_IN(x1, x2)) = 2·x1 + 2·x2   
POL(U111(x1, x2, x3, x4, x5)) = 2·x1 + 2·x2 + 2·x3 + 2·x4 + x5   
POL(U13(x1, x2, x3)) = 2·x1 + 2·x2 + x3   
POL(U14(x1, x2, x3)) = x1 + 2·x2 + x3   
POL(U91(x1, x2, x3, x4, x5)) = 2·x1 + 2·x2 + 2·x3 + 2·x4 + x5   
POL(gt_in(x1, x2)) = 2·x1 + 2·x2   
POL(gt_out(x1, x2)) = 2·x1 + x2   
POL(le_in(x1, x2)) = x1 + 2·x2   
POL(le_out(x1, x2)) = x1 + 2·x2   
POL(s(x1)) = 2·x1   



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ RuleRemovalProof
QDP
                            ↳ RuleRemovalProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2))
U111(X, L1, Y, L2, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2)
MERGE_IN(.(X, L1), .(Y, L2)) → U91(X, L1, Y, L2, le_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2)) → U111(X, L1, Y, L2, gt_in(X, Y))

The TRS R consists of the following rules:

le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))

The set Q consists of the following terms:

le_in(x0, x1)
gt_in(x0, x1)
U14(x0, x1, x2)
U13(x0, x1, x2)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.

Strictly oriented rules of the TRS R:

le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))

Used ordering: POLO with Polynomial interpretation [25]:

POL(.(x1, x2)) = 2·x1 + x2   
POL(0) = 1   
POL(MERGE_IN(x1, x2)) = 2·x1 + 2·x2   
POL(U111(x1, x2, x3, x4, x5)) = 2·x1 + 2·x2 + x3 + 2·x4 + 2·x5   
POL(U13(x1, x2, x3)) = x1 + x2 + x3   
POL(U14(x1, x2, x3)) = x1 + 2·x2 + x3   
POL(U91(x1, x2, x3, x4, x5)) = 2·x1 + 2·x2 + 2·x3 + 2·x4 + x5   
POL(gt_in(x1, x2)) = x1 + x2   
POL(gt_out(x1, x2)) = x1 + x2   
POL(le_in(x1, x2)) = 2·x1 + 2·x2   
POL(le_out(x1, x2)) = x1 + 2·x2   
POL(s(x1)) = 2·x1   



↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ RuleRemovalProof
                          ↳ QDP
                            ↳ RuleRemovalProof
QDP
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

U91(X, L1, Y, L2, le_out(X, Y)) → MERGE_IN(L1, .(Y, L2))
U111(X, L1, Y, L2, gt_out(X, Y)) → MERGE_IN(.(X, L1), L2)
MERGE_IN(.(X, L1), .(Y, L2)) → U111(X, L1, Y, L2, gt_in(X, Y))
MERGE_IN(.(X, L1), .(Y, L2)) → U91(X, L1, Y, L2, le_in(X, Y))

The TRS R consists of the following rules:

le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))

The set Q consists of the following terms:

le_in(x0, x1)
gt_in(x0, x1)
U14(x0, x1, x2)
U13(x0, x1, x2)

We have to consider all (P,Q,R)-chains.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

SPLIT2_IN(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → SPLIT_IN(L1, L2, L3)
SPLIT_IN(L1, L2, L3) → SPLIT2_IN(L1, L2, L3)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
SPLIT_IN(x1, x2, x3)  =  SPLIT_IN(x1)
SPLIT2_IN(x1, x2, x3)  =  SPLIT2_IN(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
PiDP

Pi DP problem:
The TRS P consists of the following rules:

U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → MERGESORT_IN(L3, L5)
U21(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → MERGESORT_IN(L4, L6)
MERGESORT_IN(.(X, .(Y, L1)), L2) → U11(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
U11(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U21(X, Y, L1, L2, L4, mergesort_in(L3, L5))

The TRS R consists of the following rules:

mergesort_in(.(X, .(Y, L1)), L2) → U1(X, Y, L1, L2, split2_in(.(X, .(Y, L1)), L3, L4))
split2_in(.(X, .(Y, L1)), .(X, L2), .(Y, L3)) → U8(X, Y, L1, L2, L3, split_in(L1, L2, L3))
split_in(L1, L2, L3) → U7(L1, L2, L3, split2_in(L1, L2, L3))
U7(L1, L2, L3, split2_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U6(L1, L2, L3, split1_in(L1, L2, L3))
split1_in(.(X, []), .(X, []), []) → split1_out(.(X, []), .(X, []), [])
U6(L1, L2, L3, split1_out(L1, L2, L3)) → split_out(L1, L2, L3)
split_in(L1, L2, L3) → U5(L1, L2, L3, split0_in(L1, L2, L3))
split0_in([], [], []) → split0_out([], [], [])
U5(L1, L2, L3, split0_out(L1, L2, L3)) → split_out(L1, L2, L3)
U8(X, Y, L1, L2, L3, split_out(L1, L2, L3)) → split2_out(.(X, .(Y, L1)), .(X, L2), .(Y, L3))
U1(X, Y, L1, L2, split2_out(.(X, .(Y, L1)), L3, L4)) → U2(X, Y, L1, L2, L4, mergesort_in(L3, L5))
mergesort_in(.(X, []), .(X, [])) → mergesort_out(.(X, []), .(X, []))
mergesort_in([], []) → mergesort_out([], [])
U2(X, Y, L1, L2, L4, mergesort_out(L3, L5)) → U3(X, Y, L1, L2, L5, mergesort_in(L4, L6))
U3(X, Y, L1, L2, L5, mergesort_out(L4, L6)) → U4(X, Y, L1, L2, merge_in(L5, L6, L2))
merge_in(.(X, L1), .(Y, L2), .(Y, L3)) → U11(X, L1, Y, L2, L3, gt_in(X, Y))
gt_in(s(X), 0) → gt_out(s(X), 0)
gt_in(s(X), s(Y)) → U13(X, Y, gt_in(X, Y))
U13(X, Y, gt_out(X, Y)) → gt_out(s(X), s(Y))
U11(X, L1, Y, L2, L3, gt_out(X, Y)) → U12(X, L1, Y, L2, L3, merge_in(.(X, L1), L2, L3))
merge_in(.(X, L1), .(Y, L2), .(X, L3)) → U9(X, L1, Y, L2, L3, le_in(X, Y))
le_in(0, 0) → le_out(0, 0)
le_in(0, s(Y)) → le_out(0, s(Y))
le_in(s(X), s(Y)) → U14(X, Y, le_in(X, Y))
U14(X, Y, le_out(X, Y)) → le_out(s(X), s(Y))
U9(X, L1, Y, L2, L3, le_out(X, Y)) → U10(X, L1, Y, L2, L3, merge_in(L1, .(Y, L2), L3))
merge_in(L1, [], L1) → merge_out(L1, [], L1)
merge_in([], L1, L1) → merge_out([], L1, L1)
U10(X, L1, Y, L2, L3, merge_out(L1, .(Y, L2), L3)) → merge_out(.(X, L1), .(Y, L2), .(X, L3))
U12(X, L1, Y, L2, L3, merge_out(.(X, L1), L2, L3)) → merge_out(.(X, L1), .(Y, L2), .(Y, L3))
U4(X, Y, L1, L2, merge_out(L5, L6, L2)) → mergesort_out(.(X, .(Y, L1)), L2)

The argument filtering Pi contains the following mapping:
mergesort_in(x1, x2)  =  mergesort_in(x1)
.(x1, x2)  =  .(x1, x2)
U1(x1, x2, x3, x4, x5)  =  U1(x1, x2, x3, x5)
split2_in(x1, x2, x3)  =  split2_in(x1)
U8(x1, x2, x3, x4, x5, x6)  =  U8(x1, x2, x3, x6)
split_in(x1, x2, x3)  =  split_in(x1)
U7(x1, x2, x3, x4)  =  U7(x1, x4)
split2_out(x1, x2, x3)  =  split2_out(x1, x2, x3)
split_out(x1, x2, x3)  =  split_out(x1, x2, x3)
U6(x1, x2, x3, x4)  =  U6(x1, x4)
split1_in(x1, x2, x3)  =  split1_in(x1)
[]  =  []
split1_out(x1, x2, x3)  =  split1_out(x1, x2, x3)
U5(x1, x2, x3, x4)  =  U5(x1, x4)
split0_in(x1, x2, x3)  =  split0_in(x1)
split0_out(x1, x2, x3)  =  split0_out(x1, x2, x3)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x1, x2, x3, x5, x6)
mergesort_out(x1, x2)  =  mergesort_out(x1, x2)
U3(x1, x2, x3, x4, x5, x6)  =  U3(x1, x2, x3, x5, x6)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x2, x3, x5)
merge_in(x1, x2, x3)  =  merge_in(x1, x2)
U11(x1, x2, x3, x4, x5, x6)  =  U11(x1, x2, x3, x4, x6)
gt_in(x1, x2)  =  gt_in(x1, x2)
s(x1)  =  s(x1)
0  =  0
gt_out(x1, x2)  =  gt_out(x1, x2)
U13(x1, x2, x3)  =  U13(x1, x2, x3)
U12(x1, x2, x3, x4, x5, x6)  =  U12(x1, x2, x3, x4, x6)
U9(x1, x2, x3, x4, x5, x6)  =  U9(x1, x2, x3, x4, x6)
le_in(x1, x2)  =  le_in(x1, x2)
le_out(x1, x2)  =  le_out(x1, x2)
U14(x1, x2, x3)  =  U14(x1, x2, x3)
U10(x1, x2, x3, x4, x5, x6)  =  U10(x1, x2, x3, x4, x6)
merge_out(x1, x2, x3)  =  merge_out(x1, x2, x3)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x1, x2, x3, x5, x6)
U11(x1, x2, x3, x4, x5)  =  U11(x1, x2, x3, x5)
MERGESORT_IN(x1, x2)  =  MERGESORT_IN(x1)

We have to consider all (P,R,Pi)-chains